<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="k"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${path}/pages/">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>班级管理</title>
<style>
table {
	width: 60%;
	border-collapse: collapse;
	text-align: center;
}
td {
	border: 1px solid black;
}
</style>
</head>
<body>
	<center>
		<h1>学生列表</h1><hr>
		<a href="clazz_form.jsp">增加班级</a>&nbsp;&nbsp;
		<a href="${path}/action/student/addUI">增加学生</a>&nbsp;&nbsp;
		<a href="student_form_ajax.jsp">增加学生（ajax）</a>&nbsp;&nbsp;
		<br>
		<table>
			<tr>
				<td>序号</td>
				<td>姓名</td>
				<td>学号</td>
				<td>班级</td>
				<td>操作</td>
			</tr>
			<c:forEach var="s" items="${page.result}" varStatus="idx">
			<tr>
				<td>${idx.count}</td>
				<c:choose>
					<c:when test="${empty s.picPath}">
						<td>${s.name}</td>
					</c:when>
					<c:otherwise>
						<td><a href="${path}/action/student/downImg?id=${s.id}">${s.name}</a></td>
					</c:otherwise>
				</c:choose>
				<td>${s.sno}</td>
				<td>${s.cname}</td>
				<td>
					<a href="../action/student/editUI?id=${s.id}">编辑</a>
					<a href="javascript:del(${s.id})">删除</a>
				</td>
			</tr>
			</c:forEach>
		</table>
		
		<k:pager url="${path}/action/student/list" page="${page}"/>		
		
	</center>
	
	<script type="text/javascript">
	function del(id) {
		if(window.confirm('确定删除吗？')) {
			window.location.href = '${path}/action/student/del?id=' + id;
		}		
	}
	</script>
</body>
</html>